<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ page import="com.hzqy.commons.utils.ConstantUtils" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <meta http-equiv="pragma" content="no-cache">
    <meta http-equiv="cache-control" content="no-cache">
    <meta http-equiv="expires" content="0">
    <title>修改订单信息</title>
    <link rel="stylesheet" type="text/css"	href="../../static/js/themes/defalut.css">
    <link rel="stylesheet" type="text/css"	href="../../static/js/themes/public.css">
    <link rel="stylesheet" type="text/css"	href="../../static/js/themes/ddspstyle.css">
    <link rel="stylesheet" type="text/css"	href="../../static/js/themes/default/easyui.css">
    <link rel="stylesheet" type="text/css"	href="../../static/js/themes/icon.css">
    <link rel="stylesheet" type="text/css"	href="../../static/js/WdatePicker/skin/WdatePicker.css">
    <script type="text/javascript" src="../../static/js/jquery.min.js"></script>
    <script type="text/javascript" src="../../static/js/jquery.easyui.min.js"></script>
    <script type="text/javascript"	src="../../static/js/locale/easyui-lang-zh_CN.js"></script>
    <script type="text/javascript" src="../../static/js/jquery.validate.js"></script>
    <script type="text/javascript" src="../../static/js/index.js"></script>
    <script type="text/javascript" src="../../static/js/WdatePicker/WdatePicker.js"></script>
    <script src="../../static/js/liquidmetal.js" type="text/javascript"></script>
    <script src="../../static/js/jquery.flexselect.js" type="text/javascript"></script>
    <link rel="stylesheet" href="edit/css/flexselect.css" type="text/css" media="screen" />
    <style>
        .flexselect_selected small { color: #ddd; }
    </style>
    
    <%
        String f_sd_oid=request.getParameter("f_sd_oid");
        String f_sd_uid=request.getParameter("f_sd_uid");
        String f_sd_village=request.getParameter("f_sd_village");
        String f_sd_poid=request.getParameter("f_sd_poid");
//        String f_sd_buyTime=request.getParameter("f_sd_buyTime");
    %>
    <script type="text/javascript">
    
        window.onload=function(){
        
            selectSys();
            
        }
    
        function selectGoods(data) {
            app_ajax('../../industry/dictGood/selectGoods.do?f_sd_sys='+data.f_sd_good_sys, $("#contentForm").serialize(), function(data) {
                if (data.success) {
                    var content='';
                    for (var i=0;i<data.data.length;i++){
                        content += '<option value="'+data.data[i].f_sd_good+'">'+data.data[i].f_sd_good+'</option>';
                    }
                    $("#f_sd_good").append(content);
                } else {
                    $.messager.alert('提示', data.message, 'info', function() {
                        $.messager.progress('close');
                    });
                }
            });
        }
        function selectBrands(data) {
            app_ajax('../../industry/dictGood/selectBrands.do?f_sd_good_good='+data.f_sd_good+'&f_sd_sys='+data.f_sd_good_sys, $("#contentForm").serialize(), function(data) {
                if (data.success) {
                    var content='';
                    for (var i=0;i<data.data.length;i++){
                        content += '<option value="'+data.data[i].f_sd_brand+'">'+data.data[i].f_sd_brand+'</option>';
                    }
                    $("#f_sd_good_brand").append(content);
                } else {
                    $.messager.alert('提示', data.message, 'info', function() {
                        $.messager.progress('close');
                    });
                }
            });
        }
        
        function selectSys(){
            app_ajax('../../industry/dictGood/selectSys.do', $("#contentForm").serialize(), function(data) {
                if (data.success) {
                    var content='';
                    for (var i=0;i<data.data.length;i++){
                        content += '<option value="'+data.data[i].f_sd_sys+'">'+data.data[i].f_sd_sys+'</option>';
                    }
                    $("#f_sd_good_sys").append(content);
                } else {
                    $.messager.alert('提示', data.message, 'info', function() {
                        $.messager.progress('close');
                    });
                }
            });
        }
        function changeSys(){
            $("#f_sd_good").html('<option value="">--请选择--</option>');
            $("#f_sd_good_brand").html('<option value="">--请选择--</option>');
            app_ajax('../../industry/dictGood/selectGoods.do?f_sd_sys='+$("#f_sd_good_sys").val(), $("#contentForm").serialize(), function(data) {
                if (data.success) {
                    var content='';
                    for (var i=0;i<data.data.length;i++){
                        content += '<option value="'+data.data[i].f_sd_good+'">'+data.data[i].f_sd_good+'</option>';
                    }
                    $("#f_sd_good").append(content);
                } else {
                    $.messager.alert('提示', data.message, 'info', function() {
                        $.messager.progress('close');
                    });
                }
            });
        }
        function changeGood(){
            $("#f_sd_good_brand").html('<option value="">--请选择--</option>');
            app_ajax('../../industry/dictGood/selectBrands.do?f_sd_good_good='+$("#f_sd_good").val()+'&f_sd_sys='+$("#f_sd_good_sys").val(), $("#contentForm").serialize(), function(data) {
                if (data.success) {
                    var content='';
                    for (var i=0;i<data.data.length;i++){
                        content += '<option value="'+data.data[i].f_sd_brand+'">'+data.data[i].f_sd_brand+'</option>';
                    }
                    $("#f_sd_good_brand").append(content);
                } else {
                    $.messager.alert('提示', data.message, 'info', function() {
                        $.messager.progress('close');
                    });
                }
            });
        }
        
        $(function(){
            var f_sd_oid = '<%=f_sd_oid%>';
            $.ajax({
                url:"../../industry/DICT/selectOrderById.do?f_sd_oid="+f_sd_oid,
                success:function(data){
                    data = JSON.parse(data);
                    selectGoods(data);
                    selectBrands(data);
                    $("#f_sd_orderid").val(data.f_sd_orderid);
                    $("#f_sd_good_sys").val(data.f_sd_good_sys);
                    $("#f_sd_good_brand").val(data.f_sd_good_brand);
                    $("#f_sd_good").val(data.f_sd_good);
                    $("#f_sd_money").val(data.f_sd_money);
                }
            });
            $("#contentForm").validate({
                rules: {
                    f_sd_money: {
                        digits:true
                    },
                    f_sd_num: {
                        digits:true
                    }
                },
                messages: {
                    f_sd_money: {
                        message:"必须是数字"
                    },
                    f_sd_num: {
                        message:"必须是数字"
                    }
                }
            });
        });
        
        function _submitFm() {
            if($("#contentForm").validate().form()) {
                app_ajax('../../industry/DICT/updateOrder.do', $("#contentForm").serialize(), function(data) {
                    if (data.success) {
                        $.messager.progress('close');
                        $.messager.alert('提示', '提交成功！', 'info', function() {
                            parent.$('#dlgu').dialog('close');
                            parent.gotoSearch($('#easyui-treegrid'));
                        });
                    } else {
                        $.messager.alert('提示', data.result, 'info', function() {
                            $.messager.progress('close');
                        });
                    }
                });
            }
        }
    </script>

</head>
<body class="overfwidth">
<div class="barnavtop">您所在的位置：DICT智慧管理 &gt; 订单详情 &gt; 修改订单信息</div>
<div id="workspace">
    <div id="container">
        <div class="editspace">
            <form id="contentForm" class="cmxform" enctype="multipart/form-data" name="formName">
                <input type="hidden" id="f_sd_oid" name="f_sd_oid" value="<%=f_sd_oid%>" />
                <input type="hidden" id="f_sd_uid" name="f_sd_uid" value="<%=f_sd_uid%>" />
                <input type="hidden" id="f_sd_village" name="f_sd_village" value="<%=f_sd_village%>" />
                <input type="hidden" id="f_sd_poid" name="f_sd_poid" value="<%=f_sd_poid%>" />
                <legend>修改订单信息</legend>
    
                <fieldset>
                    <div class="fitem">
                        <table width="100%" border="0" cellpadding="0" cellspacing="0">
                            <tr>
                                <td width="30%" align="right">订单号：</td>
                                <td width="70%">
                                    <label><input type="text" name="f_sd_orderid" id="f_sd_orderid" /></label>
                                </td>
                            </tr>
                        </table>
                    </div>
                </fieldset>
                
                <fieldset>
                    <div class="fitem">
                        <table width="100%" border="0" cellpadding="0" cellspacing="0">
                            <tr>
                                <td width="30%" align="right">商品所属系统：</td>
                                <td width="70%">
                                    <select id="f_sd_good_sys" name="f_sd_good_sys" style="width: 150px" onchange="changeSys()">
                                        <option value="">--请选择--</option>
                                    </select>
                                </td>
                            </tr>
                        </table>
                    </div>
                </fieldset>
    
                <fieldset>
                    <div class="fitem">
                        <table width="100%" border="0" cellpadding="0" cellspacing="0">
                            <tr>
                                <td width="30%" align="right">商品名称：</td>
                                <td width="70%">
                                    <select id="f_sd_good" name="f_sd_good" style="width: 150px" onchange="changeGood()">
                                        <option value="">--请选择--</option>
                                    </select>
                                </td>
                            </tr>
                        </table>
                    </div>
                </fieldset>
                
                <fieldset>
                    <div class="fitem">
                        <table width="100%" border="0" cellpadding="0" cellspacing="0">
                            <tr>
                                <td width="30%" align="right">商品品牌：</td>
                                <td width="70%">
                                    <select id="f_sd_good_brand" name="f_sd_good_brand" style="width: 150px" >
                                        <option value="">--请选择--</option>
                                    </select>
                                </td>
                            </tr>
                        </table>
                    </div>
                </fieldset>
                
                <fieldset>
                    <div class="fitem">
                        <table width="100%" border="0" cellpadding="0" cellspacing="0">
                            <tr>
                                <td width="30%" align="right">商品单价：</td>
                                <td width="70%">
                                    <input type="text" name="f_sd_money" id="f_sd_money" required="required"/>
                                </td>
                            </tr>
                        </table>
                    </div>
                </fieldset>

            </form>
        </div>
        
        <div class="toolbar" style="text-align: center;">
            <a class="easyui-linkbutton" data-options="iconCls:'icon-ok'" href="javascript:void(0);" onclick="_submitFm()">保存</a>
            <a href="javascript:void(0);" data-options="iconCls:'icon-cancel'" class="easyui-linkbutton" onclick="javascript:parent.$('#dlgu').dialog('close')">取消</a>
        </div>
    </div>
</div>
</body>
</html>

